So what happens if, as it's very
likely to happen in real life, the input is not bounded
to a known interval A, B. Well, we have two choices. The first one is to clip sample. So if the sample is smaller than A, we
set it to A, and if it's greater than B, we set it to B. In this case, we introduced linear
distortion in the signal and this is really the principle behind
distortion boxes for guitars. So Interesting but not necessarily
what we want to hear all the time. Alternatively we can use
a saturation curve to smoothly map the input onto the desired range. This is closer to the saturation
characteristic of all the electronic components such as tubes that
are praised by audiophiles for their lack of audible distortion. We can plot the clipping and
saturation occurence by taking for instance the interval minus one one. And we can see that
the clipping curve would map values outside of the range
to the edge of the range. Whereas the situation curve
is linear around zero. And then tapers off asymptotically. If the input is not uniform,
we can still use a uniform quantizer and accept an hour of penalty. For instance, if the input is Gaussian, it can be shown that the mean
square error has this form. It depends now of course on
the variants of the input. But even for input signals with unit variants it
would be larger than square over 12. Alternatively if we know the exact
probability distribution function for the input. We can use the Lloyd-Max algorithm to
design an optimal quantizer for the input. Alternatively a common practice in
audio signal processing is the use of companders. The idea is that samples from signals such
as speech or music will be generally small in amplitude with the occasional excursion
into the outer reaches of the range. So for instance, this is a mu law
compander commonly used in radio. And you see that small values,
say between here and here, get allocated to a wide number
of quantization levels. Whereas the rest of the range
will share the other half. So there's a, so say,
10% of the range will get 50% of the quantization level, and the remaining
90% will get the remaining 50%. So, we have more precision for the values
that we know to be more probable.